import 'package:flutter/material.dart';

class CategoryPage extends StatefulWidget {
  CategoryPage({Key key}) : super(key: key);

  _CategoryPageState createState() => _CategoryPageState();
}

class _CategoryPageState extends State<CategoryPage> {
  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 10, 
      child: Scaffold(
       appBar: AppBar(
        backgroundColor: Colors.black26,
        title: Row(
          children: <Widget>[
            Expanded(
              child: TabBar(
                isScrollable: true, //如果有多个按钮可以滑动
                indicatorColor: Colors.blue,
                labelColor: Colors.blue,
                unselectedLabelColor: Colors.white,
                indicatorSize: TabBarIndicatorSize.label,
                tabs: <Widget>[
                  Tab(text: '热销1'),
                  Tab(text: '热销2'),
                  Tab(text: '热销3'),
                  Tab(text: '热销4'),
                  Tab(text: '热销5'),
                  Tab(text: '热销6'),
                  Tab(text: '热销7'),
                  Tab(text: '热销8'),
                  Tab(text: '热销9'),
                  Tab(text: '热销10'),
                ]
              )
            )
          ], 
        ), 
       ), 
       body: TabBarView(
         children: <Widget>[
           ListView(
              children: <Widget>[
                ListTile(
                  title: Text('第1个tab'), 
                ),
                ListTile(
                  title: Text('第1个tab'), 
                ),
                ListTile(
                  title: Text('第1个tab'), 
                )
              ], 
           ),
           ListView(
              children: <Widget>[
                ListTile(
                  title: Text('第2个tab'), 
                ),
                ListTile(
                  title: Text('第2个tab'), 
                ),
                ListTile(
                  title: Text('第2个tab'), 
                )
              ], 
           ),
           ListView(
              children: <Widget>[
                ListTile(
                  title: Text('第3个tab'), 
                ),
                ListTile(
                  title: Text('第3个tab'), 
                ),
                ListTile(
                  title: Text('第3个tab'), 
                )
              ], 
           ),
           ListView(
              children: <Widget>[
                ListTile(
                  title: Text('第4个tab'), 
                ),
                ListTile(
                  title: Text('第4个tab'), 
                ),
                ListTile(
                  title: Text('第4个tab'), 
                )
              ], 
           ),
           ListView(
              children: <Widget>[
                ListTile(
                  title: Text('第4个tab'), 
                ),
                ListTile(
                  title: Text('第4个tab'), 
                ),
                ListTile(
                  title: Text('第4个tab'), 
                )
              ], 
           ),
           ListView(
              children: <Widget>[
                ListTile(
                  title: Text('第4个tab'), 
                ),
                ListTile(
                  title: Text('第4个tab'), 
                ),
                ListTile(
                  title: Text('第4个tab'), 
                )
              ], 
           ),
           ListView(
              children: <Widget>[
                ListTile(
                  title: Text('第4个tab'), 
                ),
                ListTile(
                  title: Text('第4个tab'), 
                ),
                ListTile(
                  title: Text('第4个tab'), 
                )
              ], 
           ),
           ListView(
              children: <Widget>[
                ListTile(
                  title: Text('第4个tab'), 
                ),
                ListTile(
                  title: Text('第4个tab'), 
                ),
                ListTile(
                  title: Text('第4个tab'), 
                )
              ], 
           ),
           ListView(
              children: <Widget>[
                ListTile(
                  title: Text('第4个tab'), 
                ),
                ListTile(
                  title: Text('第4个tab'), 
                ),
                ListTile(
                  title: Text('第4个tab'), 
                )
              ], 
           ),
           ListView(
              children: <Widget>[
                ListTile(
                  title: Text('第4个tab'), 
                ),
                ListTile(
                  title: Text('第4个tab'), 
                ),
                ListTile(
                  title: Text('第4个tab'), 
                )
              ], 
           ),
         ]
        ), 
      )
    );
  }
}